﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using CRMFramework;
using CRMEntity;
using CRMBiz;

namespace CRMWeb.Pages
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //var membershipProvider = Membership.Provider as umbraco.providers.members.UmbracoMembershipProvider;
            //var str = membershipProvider.EncodePassword("kendrick");
            //Response.Write(str);
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {

            string username = txtUser.Text;
            string pass = txtPassword.Text;

            ResultsStatus result = AccountHandler.Login(username, pass);

            switch (result)
            {
                case ResultsStatus.Success:
                    Response.Redirect("~/Application/AllApplication.aspx");
                    break;
                case ResultsStatus.Empty:
                    lblLoginInfo.Text = "UserName or Password wrong";
                    break;
            }
           
        }
    }
}